﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace AleScheduler
{
    static class Program
    {
        /// <summary>
        /// Punto di ingresso principale dell'applicazione.
        /// </summary>
        [STAThread]
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new configAleSchedulr());
        }


        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            ExceptionDialog frmex;
            try
            {
                Exception ex = (Exception)e.ExceptionObject;
                frmex = new ExceptionDialog(ex, Properties.Resources.exclamation);
                frmex.errExeption = ex;
                frmex.ShowDialog();
            }
            finally
            {
                Application.Exit();
            }
        }

        public static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            ExceptionDialog frmex;
            try
            {
                Exception ex = (Exception)e.Exception;
                frmex = new ExceptionDialog(ex, Properties.Resources.exclamation);
                frmex.errExeption = ex;
                frmex.ShowDialog();
            }
            finally
            {
                Application.Exit();
            }
        }

    }
}
